<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<title>客户列表</title>
<head th:replace="top::html">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AdminLTE 2 | Starter</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<body class="fixed hold-transition skin-blue">
	<div class="wrapper">
		<!-- Main Header -->
		<div th:replace="tophtml::html"></div>

		<!-- Left side column. contains the logo and sidebar -->

		<div th:replace="left::html"></div>


		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>
					客户列表 <small>Optional description</small>
				</h1>
				<ol class="breadcrumb">
					<li><a href="/index"><i class="fa fa-dashboard"></i> 用户中心</a></li>
					<li><a href="/customer/customerList">客户管理</a></li>
				</ol>
			</section>

			<!-- Main content -->
			<section class="content container-fluid">



				<form class="form-inline" th:action="@{/customer/customerList}"
					method="get" id="from1">
					<input type="hidden" name="pageNum" id="pageNo" th:value="${pageInfo.pageNum}" />


					<div class="form-group">
						<label style="margin-left: 1px;">所属领域</label> <span
							th:each="rfd : ${researchFieldDictiontryList}"> <label
							style="font-weight: lighter;"> <input type="checkbox"
								name="researchField" th:value="${rfd.names}"
								th:text="${rfd.worth}" style="margin-left: 1px;"
								th:checked="${researchFieldArr != null ? #arrays.contains(researchFieldArr, rfd.names) : false}">
						</label>
						</span>
						<span style="margin-left: 10px; color: red;">(可以多选)</span>
					</div>
					<br />
					<div class="form-group">
						<label style="margin-left: 1px;">客户名称</label> <input type="text"
							class="form-control" name="customerName"
							th:value="${customer.customerName}" style="width: 180px;">
					</div>
					<div class="form-group">
						<label style="margin-left: 15px;">客户Id</label> <input type="text"
							class="form-control" th:if="${customer.customerNumber==null}"
							name="customerNumberId" th:value="${customer.customerNumber}"
							style="width: 180px;"> <input type="text"
							class="form-control" th:if="${customer.customerNumber!=null}"
							name="customerNumberId" th:value="'C'+${customer.customerNumber}">
					</div>

					<div class="form-group">
						<label style="margin-left: 1px;">主要需求</label> <input type="text"
							class="form-control" name="majorNeeds"
							th:value="${customer.majorNeeds}" style="width: 180px;">
					</div>
					
						<div class="form-group">
						<label style="margin-left: 1px;">录入人</label> <input type="text"
							class="form-control" name="collectPersonName"
							th:value="${customer.collectPersonName}" style="width: 180px;">
					</div>
					<br></br>

					<div class="form-group">
						<label style="margin-left: 1px;">客户类型</label> <select
							id="customerType" name="customerType" class="form-control" style="width: 180px;">
							<option th:value=null>-请选择-</option>
							<option th:each="psd : ${customerTypeList}" th:value="${psd.pid}"
								th:selected="${customer.customerType eq psd.pid}"
								th:text="${psd.worth}"></option>
						</select>
					</div>


					<div class="form-group">
						<label style="margin-left: 1px;">客户性质</label> <select id="customerNature"
							name="customerNature" class="form-control" style="width: 180px;">
							<option th:value=null>-请选择-</option>
							<option th:each="psd : ${customerNatureList}"
								th:value="${psd.pid}"
								th:selected="${customer.customerNature eq psd.pid}"
								th:text="${psd.worth}"></option>
						</select>
					</div>


					<button type="submit" class="btn btn-primary"
						style="margin-left: 40px;">搜索</button>
					<button type="reset" class="btn btn-primary" style="margin-left: 40px;">重置</button>
					<button type="button" class="btn btn-primary" id="addCustomer"
						style="margin-left: 40px;">添加</button>
					<button type="button" class="btn btn-primary" id="downloadCustomer"
						style="margin-left: 40px;">下载</button>	
					<br />
					<div>
						<span class="from-group"> <label style="margin-left: 1px;">所属地区</label>
							<input type="radio" name="domesticOrForeign" id="optionsRadios1"
							value="0" style="margin-left: 1px;"
							th:checked="${customer != null ? customer.domesticOrForeign == 0 : false}">国内
							<input type="radio" name="domesticOrForeign" id="optionsRadios2"
							value="1" style="margin-left: 15px;"
							th:checked="${customer != null ? customer.domesticOrForeign == 1 : false}">国外
						</span> <span class="form-group form-country"> <label
							style="margin-left: 108px;">国家</label> <select class="form-area"
							style="width: 180px; height: 35px; border-color: silver;">
								<option value="-1">--选择国家--</option>
								<option th:each="list:${countryDictiontryList}"
									th:value="${list.pid}" th:text="${list.worth}"
									th:selected="${list.pid eq country}"></option>
						</select>
						</span><br /> <span class="form-group form-area"> <label
							style="margin-left: 42px;">省</label> <select
							class="form-control form-area" id="provinceId"
							style="width: 182px;">
								<option th:value="-1">--选择省--</option>
								<option th:each="list:${provinceDictiontryList}"
									th:selected="${list.names eq province}"
									th:value="${list.names}" th:text="${list.worth}"></option>
						</select>
						</span> <span class="form-group form-area"> <label
							style="margin-left: 42px;">市</label> <select
							class="form-control form-area" id="cityId" style="width: 180px;">
								<option th:value="-1">--选择市--</option>
								<option th:each="cityList:${cityDictiontryList}"
									th:selected="${cityList.names eq city}"
									th:value="${cityList.names}" th:text="${cityList.worth}">--选择市--
								</option>
						</select>
						</span> <span class="form-group form-area"> <label
							style="margin-left: 48px;">区</label> <select
							class="form-control form-area" id="areaId" style="width: 180px;">
								<option th:value="-1">--选择区--</option>
								<option th:each="arealist:${areaDictiontryList}"
									th:selected="${arealist.names eq district}"
									th:value="${arealist.names}" th:text="${arealist.worth}">--选择区--
								</option>
						</select>
						</span>
					</div>
				</form>

				<div class="box">
					<!-- /.box-header -->
					<div class="box-body">
						<table class="table table-bordered">
							<tbody>
								<tr>
									<th>客户ID</th>
									<th>客户名称</th>
									<th>客户性质</th>
									<th>最新进展</th>
									<th>当前合作状态</th>
									<th>录入人</th>
									<th>操作</th>
								</tr>


								<tr th:each="customer,customerIndex :  ${pageInfo.list}">
									
									 <td title="查看客户详情">
                                        <a th:href="@{'/customer/showDetail?customerId='+${customer.pid}}" th:text="'C'+${customer.customerNumber}">查看详情</a>
                                    </td>
                                    
                                    <td width="15%">
                                        <div class="col-md-3" style="width:100%;font-size: 14px;">
                                            <div class="box box-default collapsed-box" style="border-top:0px solid #d2d6de;">
                                                <div class="box-header with-border">
                                                    <span th:if="${#strings.length(customer.customerName)>8}">
                                                        <span th:text="${#strings.substring(customer.customerName,0,8)+'......'}"></span>
                                                    </span>
                                                    <span th:unless="${#strings.length(customer.customerName)>8}">
                                                        <span th:text="${customer.customerName}"></span>
                                                    </span>
                                                    <div class="box-tools pull-right" th:if="${#strings.length(customer.customerName)>8}">
                                                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                                                            <i class="fa fa-plus"></i>
                                                        </button>
                                                    </div>
                                                </div>
                                                <div class="box-body">
                                                    <span th:text="${customer.customerName}"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                    

									<td th:text="${customer.customerNatureName}"></td>
									
                					
                					<td width="15%" >
                                        <div class="col-md-3" style="width:100%;font-size: 14px;" th:if="${customer.evolve !=null}">
                                            <div class="box box-default collapsed-box" style="border-top:0px solid #d2d6de;">
                                                <div class="box-header with-border">
                                                    <span th:attr="title=${customer.evolve}" th:if="${#strings.length(customer.evolve)>15}">
                                                        <span th:text="${#strings.substring(customer.evolve,0,15)+'......'}"></span>
                                                    </span>
                                                    <span th:unless="${#strings.length(customer.evolve)>15}">
                                                        <span th:attr="title=${customer.evolve}" th:text="${customer.evolve}"></span>
                                                    </span>
                                                    <div class="box-tools pull-right" th:if="${#strings.length(customer.evolve)>15}">
                                                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                                                            <i class="fa fa-plus"></i>
                                                        </button>
                                                    </div>
                                                </div>
                                                <div class="box-body">
                                                    <span th:attr="title=${customer.evolve}" th:text="${customer.evolve}"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </td>
									
									<td th:text="${customer.currentStateName}"></td>
									
									<td th:text="${customer.remark5}"></td>
									
									<td th:with="isSubed=${#lists.contains(subDemandIdList, customer.pid)}">
									<a
										th:href="@{/customer/customerDemandList(pid=${customer.pid})}">需求列表</a>|
										<a th:if="${customer.customerContact==null}"
										th:href="@{/customer/addCustomerContact(pid=${customer.pid})}">添加联系人|</a>
										<a th:if="${customer.customerContact!=null}"
										th:href="@{'/customer/updateView?pid='+${customer.customerContact}+'&customerId='+${customer.pid}+'&origType=333'}">修改联系人|</a>
										
										
										<a th:href="@{/customer/queryCustomerConference(customerId=${customer.pid})}">参会</a>|
										<a
										th:href="@{'/customer/mateProjectView?pid='+${customer.pid}+'&customerNumber='+${customer.customerNumber}+'&customerName='+${customer.customerName}}">推送项目</a>|
										<a th:href="@{/customer/updateCustomer(pid=${customer.pid})}">修改</a>|
										
										<a th:if="${isSubed}" th:id="${customer.pid}" href="javascirpt:void(0)" th:onclick="'javascript:delSub(\''+${customer.pid}+'\',3)'">取消关注</a>
                                        <a th:unless="${isSubed}" th:id="${customer.pid}" href="javascirpt:void(0)" th:onclick="'javascript:subscribe(\''+${customer.pid}+'\',3)'">关注</a>
									</td>
								</tr>

							</tbody>
						</table>
					</div>
					<div th:replace="page::html"></div>
				</div>



			</section>
			<!-- /.content -->
		</div>
		<div th:replace="footer::html"></div>
		<div class="control-sidebar-bg"></div>

	</div>
	<div th:replace="bottom::html"></div>
	<script type="text/javascript">
		$(function() {
			//进入添加页面
			$(document).on('click', '#addCustomer', function() {
				window.location.href = "/customer/addCustomer";
			});
			
			$(document).on('click', '#downloadCustomer', function() {
				window.location.href = "/customer/download";
			})
		});
		
	</script>

</body>
</html>